const WebSocket = require('ws')
let url = "ws://82.157.33.142:8085"
const ws = new WebSocket(url);
ws.onopen = (e) => {
    //成功连接服务器回调
    console.log('客户端（client）：与服务器的连接已打开')
    // 发送配置
    // ws.send({"interim_results":true,"config":{"language_code":"zh-cmn-Hans-CN","sample_rate_hertz":16000,"encoding":"LINEAR16"}});
    ws.send("config");
}
ws.onmessage = (e) => {
    // console.log("-------onmessage---",e);
    if (typeof e.data === "string") {
        console.log("************String message received", e.data);
    } else {
        console.log("***************------------Other message received", e, e.data);
    }
}
ws.onerror = function (e) {
    console.log("WebSocket Error: ", e);
};

ws.onclose = (e) => {
    console.log("-------close---，录音结束");
}
console.log("open...........", this.recorder);